#pragma once 

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<fcntl.h>
#include<unistd.h>
#include<sys/types.h>
#include<sys/stat.h>


#define LINE_SIZE 1024
#define FLUSH_LINE 1
#define FLUSH_NOW 2
#define FLUSH_FULL 4


struct _myFILE
{
  unsigned int flags;
  int fileno;
  //buffer
  char cache[LINE_SIZE];
  int cap;
  int pos;
};

typedef struct _myFILE myFILE;

myFILE* my_fopen(const char* path,const char* mode);
void my_fflush(myFILE* pf);
int my_fwrite(myFILE* pf,const char* buf,int len);
void my_fclose(myFILE* pf);
